package cn.lingyangwl.agile.model.module.config.param.email;

import cn.lingyangwl.agile.model.constants.ValidationCons;
import cn.lingyangwl.agile.model.enums.ConfigKeyEnum;
import cn.lingyangwl.agile.model.module.config.param.EmailParam;
import cn.lingyangwl.framework.data.mate.annotations.FieldSensitive;
import cn.lingyangwl.framework.data.mate.fieldsensitive.enums.StrategyType;
import com.alibaba.fastjson2.JSON;
import lombok.Getter;
import lombok.Setter;
import org.springframework.stereotype.Component;

import javax.validation.constraints.NotEmpty;

/**
 * 网易短信
 * @author shenguangyang
 */
@Getter
@Setter
@Component
public class Email163Param extends EmailParam<Email163Param> {
    /**
     * 发送邮件的账户
     */
    @NotEmpty(message = ValidationCons.NOT_EMPTY)
    @FieldSensitive(StrategyType.RESERVE_4)
    private String username;

    /**
     * 授权码
     */
    @NotEmpty(message = ValidationCons.NOT_EMPTY)
    @FieldSensitive(StrategyType.RESERVE_4)
    private String password;


    @Override
    protected Email163Param jsonToObject(String json) {
        return JSON.parseObject(json, Email163Param.class);
    }

    @Override
    public ConfigKeyEnum configKey() {
        return ConfigKeyEnum.EMAIL_163;
    }
}
